<!DOCTYPE html>
<html>
<head>
<title>test to close hanging wss connection</title>
<script type="text/javascript">

var href = window.location.href;
var hostBegin = href.indexOf('/') + 2;
var hostEnd = href.lastIndexOf(':');
var host = href.slice(hostBegin, hostEnd);
var queryBegin = href.lastIndexOf('?') + 1;
var port = href.slice(queryBegin);
var url = 'wss://' + host + ':' + port;

// Do connection test.
var ws = new WebSocket(url);
ws.onopen = function() {
  // Set document title to 'FAIL'. The test observer catches this title change
  // to know the result.
  document.title = 'FAIL';
}
ws.onclose = function() {
  // Set document title to 'PASS'. The test observer catches this title change
  // to know the result.
  document.title = 'PASS';
}

</script>
</head>
</html>
